package com.roam.entity.scene;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Nearby {
    private List<NearbyPlace> nearbyAttractions;
    private List<NearbyPlace> nearbyFoods;
    private List<NearbyPlace> nearbyShoppingMalls;

    public List<Map> getNearRes() {
        List<Map> nearRes = new ArrayList<>();
        int size = nearbyFoods.size();
        for (int i = 0; i < size; i++) {
            NearbyPlace nearbyPlace = nearbyFoods.get(i);
            Map<String,Object> result = new HashMap<>();
            result.put("name", nearbyPlace.getName());
            result.put("distance",nearbyPlace.getDistance());
            result.put("url",nearbyPlace.getImage());
            result.put("city",nearbyPlace.getCity());
            result.put("sceneID",nearbyPlace.getSceneID());
            nearRes.add(result);
        }
        return nearRes;
    }
    public List<Map> getNearScene() {
        List<Map> nearScene = new ArrayList<>();
        int size = nearbyAttractions.size();
        for (int i = 0; i < size; i++) {
            NearbyPlace nearbyPlace = nearbyAttractions.get(i);
            Map<String,Object> result = new HashMap<>();
            result.put("name", nearbyPlace.getName());
            result.put("distance",nearbyPlace.getDistance());
            result.put("url",nearbyPlace.getImage());
            result.put("city",nearbyPlace.getCity());
            result.put("sceneID",nearbyPlace.getSceneID());
            nearScene.add(result);
        }
        return nearScene;
    }
    public List<Map> getNearShop() {
        List<Map> nearShop = new ArrayList<>();
        int size = nearbyShoppingMalls.size();
        for (int i = 0; i < size; i++) {
            NearbyPlace nearbyPlace = nearbyShoppingMalls.get(i);
            Map<String,Object> result = new HashMap<>();
            result.put("name", nearbyPlace.getName());
            result.put("distance",nearbyPlace.getDistance());
            result.put("url",nearbyPlace.getImage());
            result.put("city",nearbyPlace.getCity());
            result.put("sceneID",nearbyPlace.getSceneID());
            nearShop.add(result);
        }
        return nearShop;
    }
}
